/**
 * 获取中奖的奖品
 */
var prizeNum = parseInt(GetQueryString('prizeIndex'));
ajax({
   method : 'get',
   src : 'json/prizes.json',
   async : true,
   data : {},
   success : function(res) {
   	   //转化为JSON对象
       res = JSON.parse(res);

       //匹配中奖产品
       var prizeSrc = res[prizeNum].src;
       var prizeName = res[prizeNum].prizeName;

       //奖品显示区域
       var prizeBox = document.getElementsByClassName('redeem-prize')[0];
       prizeBox.children[0].src = prizeSrc;
       var nameBox = document.getElementById('prizeName');
       nameBox.innerHTML = prizeName;
   }
});


/**
 * 马上兑奖
 */
var redeemBtn = document.getElementsByClassName('redeem-btn')[0];
var awardBox = document.getElementsByClassName('award-box')[0];
var awardMsg = document.getElementsByClassName('award-msg')[0];
redeemBtn.addEventListener('click',function(){
	awardBox.classList.remove('slideOutDown');
    awardBox.classList.add('animated','slideInUp');
    awardBox.style.display = 'block';
});


/**
 * 关闭兑奖信息窗口
 */
var close = document.getElementsByClassName('close')[0];
close.addEventListener('click',function(){
	awardBox.classList.remove('slideInUp');
	awardBox.classList.add('slideOutDown');
});